package yl.hs.bmipfull.daos.finance;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import yl.hs.bmipfull.daos.BaseDao;
import yl.hs.bmipfull.pojo.finance.SettleOrderEntity;
import yl.hs.bmipfull.pojo.material.PurchaseReceiptEntity;
import yl.hs.bmipfull.pojo.production.ProductShipOrderEntity;

import java.util.List;

/**
 * ISettleOrderDao 结算单单据关联数据操作接口
 * @category 财务管理——结算单单据关联
 * @author 谢景广
 * @date 2021-12-29
 */
@Repository
public interface ISettleOrderDao extends BaseDao<SettleOrderEntity> {

    /**
     * 根据结算单编号删除结算单数据关联关系
     * @param settleSN 结算单编号
     * @return 删除结果
     */
    Integer deleteBySettleSN(@Param("settleSN") String settleSN);

    /**
     * 根据结算单编号获取参与结算的产品发货单信息
     * @param settleSN 结算单编号
     * @return 发货单集合
     */
    List<ProductShipOrderEntity> queryShipOrdersBySettleSN(@Param("settleSN") String settleSN);

    /**
     * 根据结算单明细编号获取参与结算的产品发货单信息
     * @param detailSN 结算单明细编号
     * @return 发货单集合
     */
    List<ProductShipOrderEntity> queryShipOrdersByDetailSN(@Param("detailSN") String detailSN);

    /**
     * 根据结算单编号获取参与结算的原材入库单信息
     * @param settleSN 结算单编号
     * @return 原材入库单集合
     */
    List<PurchaseReceiptEntity> queryReceiptOrdersBySettleSN(@Param("settleSN") String settleSN);

    /**
     * 根据结算单明细编号获取参与结算的原材入库单信息
     * @param detailSN 结算单明细编号
     * @return 原材入库单集合
     */
    List<PurchaseReceiptEntity> queryReceiptOrdersByDetailSN(@Param("detailSN") String detailSN);

    Integer insertBatch(List<SettleOrderEntity> relOrderList);

    List<String> queryShipOrderSNListBySettleSN(@Param("settleSN") String settleSN);
    List<String> queryOrderSnBySettleSN(@Param("settleSN") String settleSN);
    String getFirstPurchaseReceiptSn(String settleDetailSn);
}
